//
//  MiaoSha_Day_Header_CCell.swift
//  MikerShop
//
//  Created by eme on 2017/2/23.
//  Copyright © 2017年 eme. All rights reserved.
//

/*
 owner:cy
 update:2017年02月20日11:12:16
 info: 秒杀 筛选cell
 VC :  HomePageVc
 */
import UIKit
import RxSwift
import RickonCore
import SwiftDate

class MiaoSha_Day_Header_CCell: UICollectionViewCell {
    
    @IBOutlet weak var time_Lb: UILabel!
    @IBOutlet weak var day_Lb: UILabel!
    @IBOutlet weak var description_Lb: UILabel!
    
    @IBOutlet weak var bg_V: UIView!
    var item:MiaoShaModel? {
        didSet{
            if let item  = self.item {
                self.description_Lb.text = item.descriptionValue
                let servertime = item.serverTime!
                if servertime.isYesterday {
                    self.day_Lb.text = "昨天"
                }else if servertime.isTomorrow {
                    self.day_Lb.text = "明天"
                }else if servertime.isInSameDayOf(date: (DateInRegion() +  2.days).absoluteDate) {
                    self.day_Lb.text = "后天"
                }else{
                   self.day_Lb.text = servertime.string(format:.custom("MM月dd日"))
                }
                self.time_Lb.text = servertime.string(format:.custom("HH:mm"))
            }
        }
    }
    func updateState(isSelected:Bool)  {
        if isSelected {
            self.bg_V.backgroundColor = Theme.btn.normal
            self.time_Lb.textColor = UIColor.white
            self.day_Lb.textColor = UIColor.white
            self.description_Lb.textColor = UIColor.white
        }else{
            self.bg_V.backgroundColor = UIColor(hex: "f4f4f4")
            self.time_Lb.textColor = UIColor(hex: "4d4d4d")
            self.day_Lb.textColor = UIColor(hex: "4d4d4d")
            self.description_Lb.textColor = UIColor(hex: "4d4d4d")
        }
    }
    
    override func awakeFromNib() {
        
    }
    
}

